package com.thermal.thermal_inspection.mapper;

import com.thermal.thermal_inspection.entity.Inspection;
import com.thermal.thermal_inspection.entity.InspectionWork;
import com.thermal.thermal_inspection.vo.InspectionWorkVO;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

@Repository
@Mapper
public interface InspectionWorkMapper {
    /**
     * 通过inspectionWorkName获取巡检任务对象
     */
    InspectionWork getInspectionWorkByName(String inspectionWorkName);

    /**
     * 新增inspection_work表
     */
    int addInspectionWork(Timestamp inspectionStartTime, int inspectionLimitTime, String inspectionWorkName,
                          int inspectionId, int inspectionWorkNumber, int inspectionWorkStatus);

    /**
     * 通过id通过获取status
     */
    Integer getStatusById(int userId);

    /**
     * 通过id获取inspectionWork对象
     */
    InspectionWork getInspectionWorkById(int inspectionWorkId);

    /**
     * 删除巡检任务
     */
    int deleteInspection(int inspectionId);

    /**
     * 删除分配巡检任务
     */
    int deleteInspectionWork(int inspectionWorkId);

    /**
     * 通过开始时间和结束时间获得inspectionWork列表
     */
    List<InspectionWork> getInspectionWorkByTime(Date startDate, Date endDate);

    /**
     * 获取处理中任务
     */
    List<InspectionWork> getFinishingInspectionWork();

    /**
     * 获取未完成任务
     */
    List<InspectionWork> getStartInspectionWork();

    /**
     * 巡检点位完成数量加
     */
    int addNum(int inspectionWorkId);

    /**
     * 设置完成时间
     */
    int setEndTime(Timestamp endTime, int inspectionWorkId);

    /**
     * 设置任务状态
     */
    int setStatus(int inspectionWorkStatus, int inspectionWorkId);

    /**
     * 获取所有任务id
     */
    List<Integer> getInspectionWorkId();

    /**
     * 获取所有状态为2已完成的分配巡检任务id
     */
    List<Integer> getMonthFinishedInspectionWork();

    /**
     * 获取巡检任务点位数量
     */
    int getInspectionWorkNumber(int inspectionWorkId);

    /**
     * 获取巡检任务点位完成数量
     */
    int getInspectionWorkFinish(int inspectionWorkId);

    List<Date> getInspectionStartDate();

    List<Date> getInspectionEndDate();

    /**
     * 根据模版任务的Id来查是否存在使用这个模版任务的分配任务
     * @return InspectionWork
     */
    InspectionWork getInspectionWorkByInspectionId(int inspectionId);
    /**
     * 修改巡检任务信息
     */
    Integer updateInspectionWork(InspectionWorkVO inspectionWorkVO);
    /**
     * 根据WorkBeginId，WorkEndId，startDate，endDate来查询inspectionWork
     */
    List<InspectionWork> getInspectionWorkByTimeAndIdRange(int workBeginId,int workEndId,Date startDate, Date endDate);

    /**
     * 将任务结束设置为null
     */
    void setEndTimeNull(int inspectionWorkId);
}
